<?php

defined('IN_IA') or exit('Access Denied');
$do = in_array($do, array('list','detail')) ? $do : 'list';
if($do == 'list'){
    $sql = "select m.mid,m.title,m.version,m.price, um.deadline as dtime from ".tablename('modules')." m LEFT JOIN (SELECT * from ".tablename('users_modules')." where uid=".$_W['web_uid'].") um on m.mid=um.mid";
    $modules = pdo_fetchall($sql);
}
if($do =='detail'){
    $mid = $_GPC['mid'];
    if(empty($mid)){
        exit("非法访问");
    }
    $module = pdo_get('modules',array('mid'=>$mid));
    if(is_error($module)){
        exit('访问的数据不存在');
    }
}
template('module/list');